<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("comctrls.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class sms_send extends Page
{
       public $lblContactNo = null;
       public $Label9 = null;
       public $lblContactPerson = null;
       public $Label8 = null;
       public $lblBusinessType = null;
       public $Label7 = null;
       public $lblPhone = null;
       public $Label6 = null;
       public $lblAreaCode = null;
       public $Label5 = null;
       public $lblAddress = null;
       public $Label4 = null;
       public $lblEmail = null;
       public $Label3 = null;
       public $lblCompanyName = null;
       public $btnSend = null;
       public $btnClose = null;
       public $Label2 = null;
       public $Label1 = null;
       public $memoMessage = null;
       public $editMobile = null;
       function sms_sendCreate($sender, $params)
       {
        $get_comp = $_GET['company_id'];
        $company_id = base64_decode($get_comp);
        $this->companyDetails($company_id);
       }


       function companyDetails($comp_id)
       {
        $query_comp = "SELECT * FROM company_tbl WHERE company_id='".$comp_id."'";
        $result_comp = mysql_query($query_comp) or die("SELECT COMPANY ".mysql_error());
        $row_comp = mysql_fetch_array($result_comp);

        $this->lblCompanyName->setCaption($row_comp['company_name']);
        $this->lblEmail->setCaption($row_comp['general_email']);
        $this->lblAddress->setCaption($row_comp['address']);
        $this->lblAreaCode->setCaption($row_comp['acode']);
        $this->lblPhone->setCaption($row_comp['comp_phone']);
        $this->lblBusinessType->setCaption($row_comp['business_type']);
        $this->lblContactPerson->setCaption($row_comp['contact_person']);
        $this->lblContactNo->setCaption($row_comp['contact_person_num']);
       }

       function btnSendJSClick($sender, $params)
       {

       ?>
       var mobile = document.getElementById('editMobile').value;
       var message = document.getElementById('memoMessage').value;

       var xmlhttp;
       if (window.XMLHttpRequest)
       {
        xmlhttp = XMLHttpRequest();
       }
       if (window.ActiveXObject)
       {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       }

       if (xmlhttp==null)
       {
        alert ("Your browser does not support AJAX!");
        return false;
       }
       var url="sms_ajax_send.php";
       url=url+"?mobile="+mobile;
       url=url+"&message="+message;

       xmlhttp.open("GET",url,true);
       xmlhttp.send(null);
       window.close();
       <?php

       }

       function btnCloseJSClick($sender, $params)
       {

       ?>
       window.close();
       <?php

       }


}

global $application;

global $sms_send;

//Creates the form
$sms_send=new sms_send($application);

//Read from resource file
$sms_send->loadResource(__FILE__);

//Shows the form
$sms_send->show();

?>